<?php

namespace app\validate\admin;

use think\Validate;

class PermissionValidate extends Validate
{
	protected $rule = [
        'name'   => 'require|length:2,24|regex:/^[\x{4e00}-\x{9fa5}a-zA-Z0-9_]+$/u',
        'auth' => 'require',
        'status' => 'require',
        '_token' => 'require|token:_token',
    ];

    protected $message = [
        'name.require'     => '权限名必须填写',
        'name.length'      => '权限名过短或过长3~20',
        'name.regex'        => '权限名格式不正确',
        'auth.require'     => 'URI必须填写',
        'status.require'   => '状态必须选择',
        '_token.require' => 'toke令牌为空',
    ];

    public function sceneGroup()
    {
        return $this->only(['_token', 'name']);
    }
}
